#!/bin/bash

#显示当前主机系统信息，包括：主机名，IPV4地址，操作系统版本，内核版本，CPU型号，内存大小，硬盘大小

RED="\E[1;31m"
GREEN="\E[1;32m"
END="\E[0m"

echo -e "$GREEN----------------------Host systeminfo------------------------$END"
echo -e "HOSTNAME:          $RED`hostname`$END"
echo -e "IPADDR:            $RED`ifconfig | head -n2 | tail -n1 | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' | head -n1`$END"
echo -e "OS_VERSION:        $RED`cat /etc/redhat-release`$END"
echo -e "KEY_NEL:           $RED`uname -r`$END"
echo -e "CPU:              $RED`lscpu | grep 'Model name' | tr -s ' '| cut -d: -f2`$END"
echo -e "MEMORY:            $RED`free -h | grep 'Mem' | tr -s ' ' : | cut -d: -f2`$END"
echo -e "DISK:              $RED`lsblk | grep '^sd' | tr -s ' ' | cut -d" " -f4`$END"
echo -e "$GREEN--------------------------------------------------------------$END"
